package easy;

public class Solution_1281 {

    public int subtractProductAndSum(int n) {
        int sum = 0, multi = 1;
        while (n > 0) {
            int mod = n % 10;
            sum += mod;
            multi *= mod;
            n /= 10;
        }
        return multi - sum;
    }

    public static void main(String[] args) {
        Solution_1281 model = new Solution_1281();
        System.out.println(model.subtractProductAndSum(234));
        System.out.println(model.subtractProductAndSum(4421));
    }
}
